<template>
	<view class="container">
		<header-view type="second" leftShow rightShow>{{$t('切换语言')}}</header-view>
		<view class="content">
			<view class="list" @tap="chooseLang('en')">
				English
			</view>
			<view class="list" @tap="chooseLang('zh-Hans')">
				中文
			</view>
			<view class="list" @tap="chooseLang('ja')">
				日本語
			</view>
		</view>
	</view>
</template>

<script>
	import headerView from "@/components/headerView/index.vue"
	export default {
		components: {
			headerView
		},
		data() {
			return {};
		},
		methods: {
			chooseLang(key) {
				this.$i18n.locale = key
				uni.setStorageSync("lang", key)
				uni.$u.toast("切换成功")
				console.log(key)
				setTimeout(() => {
					uni.switchTab({
						url: "/pages/mine/mine"
					})
				}, 500)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.container {
		.content {
			.list {
				padding: 30rpx;
				border-bottom: 2rpx solid #333;
				font-size: 32rpx;
				font-weight: 500;
				color: #fff;
			}
		}

	}
</style>